/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package app.entities.model.MockDAOImpl;

import app.entities.MOCK.MockPersistencia;
import app.entities.model.DAO.BimestreDAO;
import app.entities.model.DTO.BimestreDTO;
import java.util.ArrayList;

/**
 *
 * @author Murilo
 */
public class MockBimestreDAOImpl implements BimestreDAO{

    @Override
    public void salvar(BimestreDTO dto) {
        MockPersistencia.getInstanciaListaBimestres().add(dto);
    }

    @Override
    public void deletar(BimestreDTO dto) {
        MockPersistencia.getInstanciaListaBimestres().remove(dto);
    }

    @Override
    public void atualizar(BimestreDTO dto) {
        for(BimestreDTO bim : MockPersistencia.getInstanciaListaBimestres()){
            if(bim.getId() == dto.getId()){
                bim.setFechado(dto.isFechado());
                bim.setNotasAlunos(dto.getNotasAlunos());
                bim.setNumeroBimestre(dto.getNumeroBimestre());
            }
        }
    }

    @Override
    public ArrayList listar() {
        return MockPersistencia.getInstanciaListaBimestres();
    }
    
}
